package org.achao.pojo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.achao.exception.MyException;

/**
 * @author achao
 * @description 用户实体类
 * @date 2023/10/10 21:26
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class User {

    private String name;

    private String sex;

    private Integer age;

    public void setAge(Integer age) {
        if (age > 100) {
            throw new MyException("年龄不能超过100");
        }
        this.age = age;
    }
}
